require('normalize.css');
require('styles/App.css');

let config = require('config');

import React from 'react';
import ReactDOM from 'react-dom';
import BlogApp from './blog';
import BlogItemDetail from './blog/BlogItemDetail';
import injectTapEventPlugin from 'react-tap-event-plugin';

import configureStore from '../redux'
import {bindActionCreators} from 'redux'
import { Provider } from 'react-redux'

import DevTools from "../redux/containers/DevTools"

import { Router, Route } from 'react-router';
import createBrowserHistory from 'history/lib/createBrowserHistory';

injectTapEventPlugin();

const store = configureStore()
// Render the main component into the dom
ReactDOM.render(

    <Provider store={store}>
      <div>
      <Router history={createBrowserHistory()}>
        <Route path='/' component={BlogApp} />
        <Route path='/blog/:id/edit' component={BlogItemDetail}/>
        <Route path='/blog/new' component={BlogItemDetail}/>
      </Router>
      {
        config.default.appEnv==='dev'?
        <DevTools/>
        :''
      }

      </div>
    </Provider>

  , document.getElementById('app'));
